package com.zzy.springbootdemo.design_05_singleton;

/**
 * 单例模式 - 双重校验
 */
public class Singleton_04 {

    private static volatile Singleton_04 singleton_04;

    private Singleton_04(){
    }

    public static Singleton_04 getInstance(){
        if(singleton_04 != null){
            return singleton_04;
        }
        synchronized (Singleton_04.class){
            if(singleton_04 != null){
                return new Singleton_04();
            }
        }
        return singleton_04;
    }

}
